/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package client;

import commun.Message;
import frame.Fclient;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import user.User;

/**
 *
 * @author Qiao Bingzhi
 */
public class ClientOdImpl extends UnicastRemoteObject implements ClientOd{

    private Fclient frame;

    public ClientOdImpl() throws RemoteException{
    }
    
    

    public boolean ReceiveMessage(Message message) throws RemoteException {
         this.frame.receiveMessage(message);
         return true;
    }
    public boolean sendFriendlist(User[] users) throws RemoteException {
		// TODO Auto-generated method stub
		if(users!=null){
			frame.updateUserlist(users);
			return true;
		}
		return false;
	}
    public void addUser(User user)throws RemoteException{
		if(user!=null){
			frame.addUser(user);
		}
	}
    public void serverShutup()
		throws RemoteException{
		this.frame.quit("Problem server ,please try later");
	}
	
	public void IDReLogin()throws RemoteException{
		this.frame.quit("Number login otherwhere,prog quit");
	}
        
    public void setFrame(Fclient frame)
    {
       this.frame=frame;
    }
  }
